﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using coliseu.BussinessLayer;

namespace coliseu
{

    public partial class FrmCadLazer : Form
    {
        private LazerBL lzb;
        private area_lazer lz;

        public FrmCadLazer(area_lazer lz, LazerBL lzb)
        {
            InitializeComponent();
            this.lzb = lzb;
            this.lz = lz;
            id_area_lazerTextBox.Enabled = false;
            area_lazerBindingSource.DataSource = lz;
        }

        public FrmCadLazer(LazerBL lzb)
        {
            InitializeComponent();
            this.lzb = lzb;
            area_lazerBindingSource.AddNew();
        }


        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void FrmCadBloco_Load(object sender, EventArgs e)
        {

        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            area_lazerBindingSource.EndEdit();

            if (lz == null)
                lzb.salvar((area_lazer)area_lazerBindingSource.Current, "insert");
            else
                lzb.salvar((area_lazer)area_lazerBindingSource.Current, "edit");

            MessageBox.Show("Salvo com sucesso", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Close();
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void toolStripButton3_Click_1(object sender, EventArgs e)
        {
            Close();
        }

        private void FrmCadLazer_Load(object sender, EventArgs e)
        {

        }
    }
}
